home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / amiga / gui / mui / mui14-dv.lha / MUI / Developer / C / Examples / Pages.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-28  |  2.8 KB  |  114 lines

  1. #include "demo.h"
  2.  
  3. static char *Sex[]     = { "male","female",NULL };
  4. static char *Pages[]   = { "Race","Class","Armors","Weapons","Levels",NULL };
  5. static char *Races[]   = { "Human","Elf","Dwarf","Hobbit","Gnome",NULL };
  6. static char *Classes[] = { "Warrior","Rogue","Bard","Monk","Magician","Archmage",NULL };
  7. static char *Weapons[] = { "Staff","Dagger","Sword","Axe","Grenade",NULL };
  8.  
  9. int main(int argc,char *argv[])
  10. {
  11.     APTR app,window,pcy,pgr;
  12.     ULONG signals;
  13.     BOOL running = TRUE;
  14.  
  15.     init();
  16.  
  17.     app = ApplicationObject,
  18.         MUIA_Application_Title      , "Pages-Demo",
  19.         MUIA_Application_Version    , "$VER: Pages-Demo 6.26 (26.10.93)",
  20.         MUIA_Application_Copyright  , "⌐1992/93, Stefan Stuntz",
  21.         MUIA_Application_Author     , "Stefan Stuntz",
  22.         MUIA_Application_Description, "Show MUIs Page Groups",
  23.         MUIA_Application_Base       , "PAGESDEMO",
  24.  
  25.         SubWindow, window = WindowObject,
  26.             MUIA_Window_Title, "Character Definition",
  27.             MUIA_Window_ID   , MAKE_ID('P','A','G','E'),
  28.  
  29.             WindowContents, VGroup,
  30.  
  31.                 Child, ColGroup(2),
  32.                     Child, Label2("Name:"), Child, String("Frodo",32),
  33.                     Child, Label1("Sex:" ), Child, Cycle(Sex),
  34.                     End,
  35.  
  36.                 Child, VGroup, GroupFrame,
  37.  
  38.                     Child, pcy = Cycle(Pages),
  39.  
  40.                     Child, pgr = PageGroup,
  41.  
  42.                         Child, HCenter(Radio(NULL,Races)),
  43.  
  44.                         Child, HCenter(Radio(NULL,Classes)),
  45.  
  46.                         Child, HGroup,
  47.                             Child, HSpace(0),
  48.                             Child, ColGroup(2),
  49.                                 Child, Label1("Cloak:" ), Child, CheckMark(TRUE),
  50.                                 Child, Label1("Shield:"), Child, CheckMark(TRUE),
  51.                                 Child, Label1("Gloves:"), Child, CheckMark(TRUE),
  52.                                 Child, Label1("Helmet:"), Child, CheckMark(TRUE),
  53.                                 End,
  54.                             Child, HSpace(0),
  55.                             End,
  56.  
  57.                         Child, HCenter(Radio(NULL,Weapons)),
  58.  
  59.                         Child, ColGroup(2),
  60.                             Child, Label("Experience:"  ), Child, Slider(0,100, 3),
  61.                             Child, Label("Strength:"    ), Child, Slider(0,100,42),
  62.                             Child, Label("Dexterity:"   ), Child, Slider(0,100,24),
  63.                             Child, Label("Condition:"   ), Child, Slider(0,100,39),
  64.                             Child, Label("Intelligence:"), Child, Slider(0,100,74),
  65.                             End,
  66.  
  67.                         End,
  68.                     End,
  69.                 End,
  70.             End,
  71.         End;
  72.  
  73.     if (!app)
  74.         fail(app,"Failed to create Application.");
  75.  
  76.     DoMethod(window,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,
  77.         app,2,MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit);
  78.  
  79.  
  80. /*
  81. ** Connect cycle gadget with page group
  82. */
  83.  
  84.     DoMethod(pcy,MUIM_Notify,MUIA_Cycle_Active,MUIV_EveryTime,
  85.         pgr,3,MUIM_Set,MUIA_Group_ActivePage,MUIV_TriggerValue);
  86.  
  87.  
  88. /*
  89. ** Input loop...
  90. */
  91.  
  92.     set(window,MUIA_Window_Open,TRUE);
  93.  
  94.     while (running)
  95.     {
  96.         switch (DoMethod(app,MUIM_Application_Input,&signals))
  97.         {
  98.             case MUIV_Application_ReturnID_Quit:
  99.                 running = FALSE;
  100.                 break;
  101.         }
  102.         if (running && signals) Wait(signals);
  103.     }
  104.  
  105.     set(window,MUIA_Window_Open,FALSE);
  106.  
  107.  
  108. /*
  109. ** Shut down...
  110. */
  111.  
  112.     fail(app,NULL);
  113. }
  114.